package com.wangnan.springbootstudy.beforerun;

import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import java.util.concurrent.TimeUnit;

/**
 * 实现CommandLineRunner orApplicationRunner
 * 可在SpringApplication.run() 之前调用方法
 */
@Component
public class BeforeRun implements CommandLineRunner {
    @Override
    public void run(String... args) throws Exception {
        TimeUnit.SECONDS.sleep(5);
        System.out.println("this is run before!");
    }
}
